﻿using System.Drawing;
using System.Windows.Forms;

namespace NetTrafficStatistics
{
	class ProgressBarT: ProgressBar
	{
		public ProgressBarT ()
		{
			SetStyle(ControlStyles.UserPaint, true);
		}

		protected override void OnPaint (PaintEventArgs e)
		{
			BackColor = Color.White;

			var g = e.Graphics;
			var rec = e.ClipRectangle;

			rec.Width = rec.Width - 1;
			rec.Height = rec.Height - 1;
			g.DrawRectangle (new Pen (Color.LightGray), rec);

			rec.Width = (int)(rec.Width * ((double)Value / Maximum)) - 3;
			rec.Height = rec.Height - 3;
			g.FillRectangle (Brushes.SteelBlue, 2, 2, rec.Width, rec.Height);

			g.Dispose();
		}
	}
}
